<template>
	<view class="contain">
		<view class="item" v-for="(res, index) in siteList" :key="res.id">
			<view class="top">
				<view class="name">{{ res.name }}</view>
				<view class="phone">{{ res.phone }}</view>
				<view class="tag">
					<text v-for="(item, index) in res.tag" :key="index" :class="{red:item.tagText=='默认'}">{{ item.tagText }}</text>
				</view>
				<view class="edit">
					编辑
				</view>
			</view>
			<view class="bottom">
				{{res.site}}
				
			</view>
		</view>
		<view class="addSite" @tap="toAddSite">
			<view class="add">
				<u-icon name="plus" color="#ffffff" class="icon" :size="30"></u-icon>新建收货地址
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			siteList: []
		};
	},
	onLoad() {
		this.getData();
	},
	methods: {
		getData() {
			this.siteList = [
				{
					id: 1,
					name: '游X',
					phone: '183545555523',
					tag: [
						{
							tagText: '默认'
						},
						
					],
					site: '山东省青岛市市南区颐和国际A栋304室山东省青岛市市南区颐和国际A栋304室'
				},
				{
					id: 2,
					name: '李XX',
					phone: '183****5555',
					tag: [
						{
							tagText: '公司'
						}
					],
					site: '山东省青岛市市南区颐和国际'
				},
				{
					id: 3,
					name: '王YY',
					phone: '153****5555',
					tag: [],
					site: '山东省青岛市市南区颐和国际'
				}
			];
		},
		toAddSite(){
			uni.navigateTo({
			    url: '/pages/address/addSite'
			});
		}
	}
};
</script>

<style lang="scss" scoped>
	.contain{
		background-color: #fff;
		margin: 30rpx;
		padding:0 20rpx ;
		border-radius: $base-radius;
	}
.item {
	padding: 30rpx 0;
	border-bottom: 1px solid #F3F3F3;
	.top {
		display: flex;
		font-weight: bold;
		font-size: 28rpx;
		position: relative;
		.name{
			color: #333333;
		}
		.phone {
			font-size: 22rpx;
			color: #BFBFBF;
			display: flex;
			align-items: center;
			margin-left:17rpx;
		}
		.tag {
			display: flex;
			font-weight: normal;
			align-items: center;
			text {
				display: block;
				width: 60rpx;
				height: 34rpx;
				line-height: 34rpx;
				color: #F8321D;
				font-size: 22rpx;
				border-radius: 6rpx;
				text-align: center;
				margin-left: 30rpx;
				background-color:#FFFCE9;
			}
			.red{
				background-color:#FFFCE9;
			}
		}
		.edit{
			position: absolute;
			right: 0;
			font-weight: normal;
			color:#BFBFBF;
			font-size: 22rpx;
		}
	}
	.bottom {
		display: flex;
		margin-top: 20rpx;
		font-size: 22rpx;
		justify-content: space-between;
		color: #666666;
	}
}
.addSite {
	display: flex;
	justify-content: space-around;
	width: 600rpx;
	line-height: 100rpx;
	position: absolute;
	bottom: 30rpx;
	left: 80rpx;
	background-color: #F8321D;
	border-radius: $base-radius;
	font-size: 30rpx;
	.add{
		display: flex;
		align-items: center;
		color: #ffffff;
		.icon{
			margin-right: 10rpx;
		}
	}
}
</style>
